This is my version of the fizzbuzz test, written in C:
char *arr[] = {"%d\n", "fizz\n", "buzz\n", "fizzbuzz\n"};
for (int i=1; i<=100; i++) printf(arr[!(i%3)+2*!(i%5)], i);
or rephrased in a more readable format:
char *arr[] = {"%d\n", "fizz\n", "buzz\n", "fizzbuzz\n"};
int i, index;
for (i=1; i<=100; i++)
{
index = !(i%3) + 2 * !(i%5);
printf( arr[index], i);
}
Thanks for this post, it helpfull for me
I think the admin of this web page is genuinely working hard in support of his site, as here every stuff is quality based material.